#include "begin.h"
#include "ui_begin.h"
#include "ui_mainwindow.h"

Begin::Begin(QWidget *parent)
    : QMainWindow(parent)
    , ui(new Ui::Begin)
{
    ui->setupUi(this);
    button = new QPushButton("开始游戏",this);
    button->setGeometry(60,400,200,50);
    connect(button,SIGNAL(clicked()),this,SLOT(on_button_clicked()));
}

Begin::~Begin()
{
    delete ui;
}

void Begin::on_button_clicked()
{
    this->close();
    m = new MainWindow;
    m->show();
}

void Begin::paintEvent(QPaintEvent *)
{
    QPainter p(this);
    p.setBrush(Qt::blue);
    p.setFont(QFont("微软雅黑",10,700,false));
    QString strscore;
    p.drawText(QPoint(20,60),"游戏规则：");

    QPainter p1(this);
    p1.setBrush(Qt::blue);
    p1.setFont(QFont("微软雅黑",10,700,false));
    QString strscore1;
    p1.drawText(QPoint(20,100),"2到2048依次替换为：");

    QPainter p2(this);
    p2.setBrush(Qt::blue);
    p2.setFont(QFont("微软雅黑",10,700,false));
    QString strscore2;
    p2.drawText(QPoint(20,140),"1 2 3 4 5 6 7 8 9 10 11");

    QPainter p3(this);
    p3.setBrush(Qt::blue);
    p3.setFont(QFont("微软雅黑",10,700,false));
    QString strscore3;
    p3.drawText(QPoint(20,180),"操作键位为wsad");
}
